	IDENTIFICATION DIVISION.
	PROGRAM-ID. CARGA.
	DATE-WRITTEN. JUNIO 2013. 
	ENVIRONMENT DIVISION.
	CONFIGURATION SECTION.
	SPECIAL-NAMES.
	    DECIMAL-POINT IS COMMA.
	    
       FILE-CONTROL.
         SELECT ARCH-RES1   ASSIGN TO 'C:\RES1.DAT'
	     ORGANIZATION IS LINE SEQUENTIAL.
	     SELECT ARCH-RES2   ASSIGN TO 'C:\RES2.DAT'
		 ORGANIZATION IS LINE SEQUENTIAL.

	     SELECT ARCH-RES3   ASSIGN TO 'C:\RES3.DAT'
		 ORGANIZATION IS LINE SEQUENTIAL.

	     SELECT ARCH-VIP   ASSIGN TO 'C:\VIP.DAT'
		 ORGANIZATION IS LINE SEQUENTIAL.

	     SELECT ARCH-CAT   ASSIGN TO 'C:\CAT.DAT'
		 ORGANIZATION IS LINE SEQUENTIAL.

	     SELECT ARCH-DESC   ASSIGN TO 'C:\DESC.DAT'
		 ORGANIZATION IS LINE SEQUENTIAL.

	     SELECT ARCH-EST   ASSIGN TO 'C:\EST.DAT'
		 ORGANIZATION IS LINE SEQUENTIAL.
	     
	DATA DIVISION.
       FILE SECTION.
        FD ARCH-RES1      DATA RECORD IS REGSALIDA1
			     LABEL RECORD IS STANDARD.
        01 REGSALIDA1				PIC X(116).
	 
        FD ARCH-RES2      DATA RECORD IS REGSALIDA2
			     LABEL RECORD IS STANDARD.
        01 REGSALIDA2			PIC X(116).

        FD ARCH-RES3      DATA RECORD IS REGSALIDA3
			     LABEL RECORD IS STANDARD.
        01 REGSALIDA3			PIC X(116).

        FD ARCH-VIP      DATA RECORD IS REGSALIDAVIP
			     LABEL RECORD IS STANDARD.
        01 REGSALIDAVIP			PIC X(116).

        FD ARCH-EST      DATA RECORD IS REGSALIDAEST
			     LABEL RECORD IS STANDARD.
        01 REGSALIDAEST.
		   05 EST-COD-RES       PIC 9(6).
		   05 EST-DIGITO        PIC 9.
		   05 EST-FECHA-DES     PIC X(10).
		   05 EST-FECHA-HAS     PIC X(10).
		   05 EST-CATEG-HAB     PIC 9999.
		   05 EST-IMPORTE       PIC S9(6)V99.

        FD ARCH-CAT      DATA RECORD IS REGSALIDACAT
			     LABEL RECORD IS STANDARD.
        01 REGSALIDACAT.
           05 CAT-CATEG-HB   PIC 9(4).
           05 CAT-DESCRIP    PIC X(15).		   
        FD ARCH-DESC      DATA RECORD IS REGSALIDADESC
			     LABEL RECORD IS STANDARD.
        01 REGSALIDADESC.
            05 DESC-COD-RES   PIC 9(6).
			05 DESC-DIG       PIC 9.
			05 DESC-PORC      PIC 9(3)V99.
	
       WORKING-STORAGE SECTION.
	77 NUMSALIDA PIC S9(6)V99.

        01 WS-REGSALIDA.	
           05 WS-RES-CLAVE.
              10 WS-RES-COD-RES       PIC 9(6).
              10 WS-RES-DIGITO        PIC 9.
           05 WS-RES-FECHA-DES.
              10 WS-RES-ANIO-DES      PIC X(4).
              10 FILLER                 PIC X.
              10 WS-RES-MES-DES       PIC X(2).
              10 FILLER                 PIC X.
              10 WS-RES-DIA-DES       PIC X(2).
           05 WS-RES-FECHA-HAS.
              10 WS-RES-ANIO-HAS      PIC X(4).
              10 FILLER                 PIC X.
              10 WS-RES-MES-HAS       PIC X(2).
              10 FILLER                 PIC X.
              10 WS-RES-DIA-HAS       PIC X(2).
           05 WS-RES-CATEG-HAB        PIC 9(4).
           05 WS-RES-DATOS-PERS.
              10 WS-RES-NOMBRE-CLI    PIC X(30).
              10 WS-RES-TEL           PIC X(15).
              10 WS-RES-DIR           PIC X(30).
           05 WS-RES-IMP-RES          PIC S9(06)V99.
	
	
	PROCEDURE DIVISION.
	COMIENZO.
	    OPEN OUTPUT ARCH-RES1.
	    OPEN OUTPUT ARCH-RES2.   
	    OPEN OUTPUT ARCH-RES3.
	    OPEN OUTPUT ARCH-VIP.
		OPEN OUTPUT ARCH-EST.
		OPEN OUTPUT ARCH-CAT.
		OPEN OUTPUT ARCH-DESC.
	    PERFORM CARGAR-RES1.
	    PERFORM CARGAR-RES2.
	    PERFORM CARGAR-RES3.
	    PERFORM CARGAR-VIP.
	    PERFORM CARGAR-EST.
	    PERFORM CARGAR-CAT.
	    PERFORM CARGAR-DESC.
	    		 
	    CLOSE ARCH-RES1 ARCH-RES2 ARCH-RES3 ARCH-VIP 
			ARCH-CAT ARCH-EST ARCH-DESC.
	    STOP RUN.
	 CARGAR-RES1.   
	    INITIALIZE REGSALIDA1 
	    MOVE 123456     TO WS-RES-COD-RES.
 	    MOVE 1          TO WS-RES-DIGITO.
	    MOVE '2013'     TO WS-RES-ANIO-DES.
	    MOVE '06'       TO WS-RES-MES-DES.
	    MOVE '01'       TO WS-RES-DIA-DES.
	    MOVE '2013'     TO WS-RES-ANIO-HAS.
	    MOVE '06'       TO WS-RES-MES-HAS.
	    MOVE '21'       TO WS-RES-DIA-HAS.
	    MOVE 1234       TO WS-RES-CATEG-HAB.
	    MOVE 'NOMBRE 1'  TO WS-RES-NOMBRE-CLI.
	    MOVE '4123-4567' TO WS-RES-TEL.
           MOVE 'DIRECCION' TO WS-RES-DIR.
	    MOVE +123456,78 TO WS-RES-IMP-RES.
	    MOVE WS-REGSALIDA TO REGSALIDA1.
	    WRITE REGSALIDA1.
		
	    INITIALIZE REGSALIDA1 REPLACING ALPHANUMERIC DATA BY SPACES
	                                   NUMERIC DATA BY ZEROS.
	    MOVE 123331     TO WS-RES-COD-RES.
 	    MOVE 5          TO WS-RES-DIGITO.
	    MOVE '2013'     TO WS-RES-ANIO-DES.
	    MOVE '06'       TO WS-RES-MES-DES.
	    MOVE '04'       TO WS-RES-DIA-DES.
	    MOVE '2013'     TO WS-RES-ANIO-HAS.
	    MOVE '06'       TO WS-RES-MES-HAS.
	    MOVE '24'       TO WS-RES-DIA-HAS.
	    MOVE 1224       TO WS-RES-CATEG-HAB.
	    MOVE 'NOMBRE 5'  TO WS-RES-NOMBRE-CLI.
	    MOVE '4123-4117' TO WS-RES-TEL.
           MOVE 'DIRECCION' TO WS-RES-DIR.
	    MOVE +123476,33 TO WS-RES-IMP-RES.
	    MOVE WS-REGSALIDA TO REGSALIDA1.
	    WRITE REGSALIDA1.

	CARGAR-RES2.
	    INITIALIZE REGSALIDA2 
	    MOVE 121156     TO WS-RES-COD-RES.
 	    MOVE 1          TO WS-RES-DIGITO.
	    MOVE '2013'     TO WS-RES-ANIO-DES.
	    MOVE '06'       TO WS-RES-MES-DES.
	    MOVE '11'       TO WS-RES-DIA-DES.
	    MOVE '2013'     TO WS-RES-ANIO-HAS.
	    MOVE '06'       TO WS-RES-MES-HAS.
	    MOVE '21'       TO WS-RES-DIA-HAS.
	    MOVE 1134       TO WS-RES-CATEG-HAB.
	    MOVE 'NOMBRE 2'  TO WS-RES-NOMBRE-CLI.
	    MOVE '4553-4567' TO WS-RES-TEL.
           MOVE 'DIRECCION 2' TO WS-RES-DIR.
	    MOVE +111456,75 TO WS-RES-IMP-RES.
	    MOVE WS-REGSALIDA TO REGSALIDA2.
	    WRITE REGSALIDA2.
		
	    INITIALIZE REGSALIDA2 REPLACING ALPHANUMERIC DATA BY SPACES
	                                   NUMERIC DATA BY ZEROS.
	    MOVE 123331     TO WS-RES-COD-RES.
 	    MOVE 5          TO WS-RES-DIGITO.
	    MOVE '2013'     TO WS-RES-ANIO-DES.
	    MOVE '06'       TO WS-RES-MES-DES.
	    MOVE '14'       TO WS-RES-DIA-DES.
	    MOVE '2013'     TO WS-RES-ANIO-HAS.
	    MOVE '06'       TO WS-RES-MES-HAS.
	    MOVE '24'       TO WS-RES-DIA-HAS.
	    MOVE 1224       TO WS-RES-CATEG-HAB.
	    MOVE 'NOMBRE 22'  TO WS-RES-NOMBRE-CLI.
	    MOVE '4100-4117' TO WS-RES-TEL.
           MOVE 'DIRECCION 2' TO WS-RES-DIR.
	    MOVE -123336,31 TO WS-RES-IMP-RES.
	    MOVE WS-REGSALIDA TO REGSALIDA2.
	    WRITE REGSALIDA2.

	CARGAR-RES3.
		INITIALIZE REGSALIDA3 
	    MOVE 123456     TO WS-RES-COD-RES.
 	    MOVE 1          TO WS-RES-DIGITO.
	    MOVE '2013'     TO WS-RES-ANIO-DES.
	    MOVE '06'       TO WS-RES-MES-DES.
	    MOVE '01'       TO WS-RES-DIA-DES.
	    MOVE '2013'     TO WS-RES-ANIO-HAS.
	    MOVE '06'       TO WS-RES-MES-HAS.
	    MOVE '21'       TO WS-RES-DIA-HAS.
	    MOVE 1234       TO WS-RES-CATEG-HAB.
	    MOVE 'NOMBRE 1'  TO WS-RES-NOMBRE-CLI.
	    MOVE '4123-4567' TO WS-RES-TEL.
           MOVE 'DIRECCION' TO WS-RES-DIR.
	    MOVE +123456,78 TO WS-RES-IMP-RES.
	    MOVE WS-REGSALIDA TO REGSALIDA3.
	    WRITE REGSALIDA3.
		
	    INITIALIZE REGSALIDA3 REPLACING ALPHANUMERIC DATA BY SPACES
	                                   NUMERIC DATA BY ZEROS.
	    MOVE 123331     TO WS-RES-COD-RES.
 	    MOVE 5          TO WS-RES-DIGITO.
	    MOVE '2013'     TO WS-RES-ANIO-DES.
	    MOVE '06'       TO WS-RES-MES-DES.
	    MOVE '04'       TO WS-RES-DIA-DES.
	    MOVE '2013'     TO WS-RES-ANIO-HAS.
	    MOVE '06'       TO WS-RES-MES-HAS.
	    MOVE '24'       TO WS-RES-DIA-HAS.
	    MOVE 1224       TO WS-RES-CATEG-HAB.
	    MOVE 'NOMBRE 5'  TO WS-RES-NOMBRE-CLI.
	    MOVE '4123-4117' TO WS-RES-TEL.
           MOVE 'DIRECCION' TO WS-RES-DIR.
	    MOVE +123476,33 TO WS-RES-IMP-RES.
	    MOVE WS-REGSALIDA TO REGSALIDA3.
	    WRITE REGSALIDA3.
		   
	CARGAR-VIP.
		INITIALIZE REGSALIDAVIP 
	    MOVE 123456     TO WS-RES-COD-RES.
 	    MOVE 1          TO WS-RES-DIGITO.
	    MOVE '2013'     TO WS-RES-ANIO-DES.
	    MOVE '06'       TO WS-RES-MES-DES.
	    MOVE '01'       TO WS-RES-DIA-DES.
	    MOVE '2013'     TO WS-RES-ANIO-HAS.
	    MOVE '06'       TO WS-RES-MES-HAS.
	    MOVE '21'       TO WS-RES-DIA-HAS.
	    MOVE 1234       TO WS-RES-CATEG-HAB.
	    MOVE 'NOMBRE 1'  TO WS-RES-NOMBRE-CLI.
	    MOVE '4123-4567' TO WS-RES-TEL.
           MOVE 'DIRECCION' TO WS-RES-DIR.
	    MOVE +123456,78 TO WS-RES-IMP-RES.
	    MOVE WS-REGSALIDA TO REGSALIDAVIP.
	    WRITE REGSALIDAVIP.
		
	    INITIALIZE REGSALIDAVIP REPLACING ALPHANUMERIC DATA BY SPACES
	                                   NUMERIC DATA BY ZEROS.
	    MOVE 123331     TO WS-RES-COD-RES.
 	    MOVE 5          TO WS-RES-DIGITO.
	    MOVE '2013'     TO WS-RES-ANIO-DES.
	    MOVE '06'       TO WS-RES-MES-DES.
	    MOVE '04'       TO WS-RES-DIA-DES.
	    MOVE '2013'     TO WS-RES-ANIO-HAS.
	    MOVE '06'       TO WS-RES-MES-HAS.
	    MOVE '24'       TO WS-RES-DIA-HAS.
	    MOVE 1224       TO WS-RES-CATEG-HAB.
	    MOVE 'NOMBRE 5'  TO WS-RES-NOMBRE-CLI.
	    MOVE '4123-4117' TO WS-RES-TEL.
           MOVE 'DIRECCION' TO WS-RES-DIR.
	    MOVE +123476,33 TO WS-RES-IMP-RES.
	    MOVE WS-REGSALIDA TO REGSALIDAVIP.
	    WRITE REGSALIDAVIP.
		   
0	CARGAR-EST.
	    MOVE 123456       TO EST-COD-RES.
 	    MOVE 1            TO EST-DIGITO.
	    MOVE '2013 06 01' TO EST-FECHA-DES.
	    MOVE '2013 06 29' TO EST-FECHA-HAS.
	    MOVE 1234         TO WS-RES-CATEG-HAB.
	    MOVE +123456,78   TO WS-RES-IMP-RES.
	    WRITE REGSALIDAEST.

	CARGAR-DESC.
	     MOVE 123456      TO DESC-COD-RES 
	     MOVE 1           TO DESC-DIG     
         MOVE 15          TO DESC-PORC    
		 WRITE REGSALIDADESC.
		
	CARGAR-CAT.  
		 INITIALIZE REGSALIDACAT	
         MOVE 1234       TO CAT-CATEG-HB
		 MOVE 'CAT01'    TO CAT-DESCRIP 
		 WRITE REGSALIDACAT AFTER 1 LINE
		 INITIALIZE REGSALIDACAT	
		 MOVE 4567       TO CAT-CATEG-HB
		 MOVE 'CAT02'    TO CAT-DESCRIP
		 WRITE REGSALIDACAT AFTER 1 LINE 
		 INITIALIZE REGSALIDACAT			 
		 MOVE 9876       TO CAT-CATEG-HB
		 MOVE 'CAT04'    TO CAT-DESCRIP
		 WRITE REGSALIDACAT AFTER 1 LINE
		 INITIALIZE REGSALIDACAT	
		 MOVE 5069       TO CAT-CATEG-HB
		 MOVE 'CAT03'    TO CAT-DESCRIP
		 WRITE REGSALIDACAT.

